<!DOCTYPE html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
	<meta name="keywords" content="">
	<meta name="description" content="">
	<title>青之巅-我的消息</title>
	<#include "../common/reslistmy.html">
</head>
<body>
<#include "../common/header3.html">

<div id="main">

	<div id="notices" class="noticesPage">
		<ul class="n-tab clearfix">
			<li class="active">
				<a id="not_new" href="${s.base}/user/notice.html">通知<span class="not-num">(<#if (page.itemsTotalCount)??>${page.itemsTotalCount}</#if>)</span></a>
			</li>

		</ul>

		<div class="content">

			<div class="title-bar">
				<a class="tag-read-btn" href="javascript:readAll('${page.pageNum}')">全部标记为已读</a>
				<a class="tag-read-btn" href="javascript:delAll('${page.pageNum}')">全部删除</a>
			</div>

			<div class="notice-list">
				<form id="queryPageForm" action="${s.base}/user/notice.html">
					<input type="hidden" id="optId"/>
					<#if (page.items)??>
					<#list page.items as item>
					<div note-id="${item.id}" class="notice">
						<div class="notice-box clearfix">
							<p id="noticeCreateUser${item.id}"
							<#if ((item.readStatus)?? && item.readStatus==0)>
							class="notice-type "
							<#else>
							class="notice-type already-read "
						</#if>
						>
						${item.createUser}
						</p>

						<div class="notice-show-box">
							<p id="noticeTitle${item.id}"
							<#if ((item.readStatus)?? && item.readStatus==0)>
							class="notice-title "
							<#else>
							class="notice-title pass "
						</#if>
						>
						${item.title}
						</p>


						<p id="noticeContents${item.id}"
						<#if ((item.readStatus)?? && item.readStatus==0)>
						class="notice-title "
						<#else>
						class="notice-title pass "
					</#if>
					>
					${item.contents}
					</p>
			</div>
			<div class="notice-show-date">
				<h5 class="notice-date">${item.sendDate?string('yyyy-MM-dd')}</h5>
				<div class="del-box clearfix" id = "testDiv${item.id}">
					<a href="javascript:delNotice(${item.id})" class="del-notice " title="删除此通知">
						<i class="icon icon-del"></i>
					</a>
					<#if ((item.readStatus)?? && item.readStatus==0)>
					<a href="javascript:readNotice(${item.id})" class="read-notice " title="已读">
											<span id="readSpan${item.id}" >
												设为已读
											</span>
					</a>
				</#if>
			</div>
		</div>
	</div>
</div>
</#list>
<#include "../common/tailPage2.html">
</#if>
</form>

</div>
</div>

</div>

<#include "../common/footer3.html">

<!--script-->

<script>
    //单个已读
    function readNotice(id){
        var url = '${s.base}/user/readNotice.html';
        $.ajax({
            url:url,
            type:'POST',
            dataType:'json',
            data:{"id":id},
            success:function(resp){
                if(resp.errcode == 0){
                    $('#noticeCreateUser'+id).addClass('already-read');
                    $('#noticeTitle'+id).addClass('pass ');
                    $('#noticeContents'+id).addClass('pass ');
                    $('#readSpan'+ id).html('');
                }
            }
        });
    }

    function readAll(){
        $('#queryPageForm').attr('action','${s.base}/user/readNoticeALL.html');
        $('#queryPageForm').submit();
    }

    //单个删除
    function delNotice(id){
        var url = '${s.base}/user/delNotice.html';
        $.ajax({
            url:url,
            type:'POST',
            dataType:'json',
            data:{"id":id},
            success:function(resp){
                if(resp.errcode == 0){
                    $('#queryPageForm').submit();
                }
            }
        });
    }

    function delAll(){
        $('#queryPageForm').attr('action','${s.base}/user/delNoticeAll.html');
        $('#queryPageForm').submit();
    }
</script>

</body>
</html>